* JDBC common code.

Common code related to JDBC.

** Status of the project

[[https://github.com/steinarb/jdbc/actions/workflows/jdbc-maven-ci-build.yml][file:https://github.com/steinarb/jdbc/actions/workflows/jdbc-maven-ci-build.yml/badge.svg]]
[[https://coveralls.io/github/steinarb/jdbc][file:https://coveralls.io/repos/github/steinarb/jdbc/badge.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=alert_status#.svg]]
[[https://maven-badges.herokuapp.com/maven-central/no.priv.bang.jdbc/jdbc][file:https://maven-badges.herokuapp.com/maven-central/no.priv.bang.jdbc/jdbc/badge.svg]]
[[https://www.javadoc.io/doc/no.priv.bang.jdbc/jdbc][file:https://www.javadoc.io/badge/no.priv.bang.jdbc/jdbc.svg]]

[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/images/project_badges/sonarcloud-white.svg]]

[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=sqale_index#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=coverage#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=ncloc#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=code_smells#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=sqale_rating#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=security_rating#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=bugs#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=vulnerabilities#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=duplicated_lines_density#.svg]]
[[https://sonarcloud.io/summary/new_code?id=steinarb_jdbc][file:https://sonarcloud.io/api/project_badges/measure?project=steinarb_jdbc&metric=reliability_rating#.svg]]

** Release history

| Date                   | Version | Comment                                                                  |
|------------------------+---------+--------------------------------------------------------------------------|
| <2023-07-26 Wed 21:05> |   1.2.0 | Add ResultSetSqlDumper, build with Java 17                               |
| <2021-06-11 Fri 00:13> |   1.1.1 | Provide a Bill of Materials (BoM)                                        |
| <2021-04-15 Thu 19:49> |   1.1.0 | Get dependencies and maven config from parent POM. New versions of stuff |
| <2020-01-03 Fri 23:55> |   1.0.0 | Add JDBC DataSourceProxy                                                 |

** Overview of the project
*** DataSourceProxy

This is an implementation of the [[https://docs.oracle.com/javase/8/docs/api/javax/sql/DataSource.html][DataSource]] interface that has a different DataSource as a property and delegates all methods to the wrapped DataSource object.

[[https://www.javadoc.io/doc/no.priv.bang.jdbc/jdbc/latest/no/priv/bang/jdbc/datasourceproxy/DataSourceProxy.html][Javadoc for the DataSourceProxy class]].

To use this in an OSGi maven project by first importing the BoM
#+begin_src xml
  <dependencies>
      <dependency>
          <groupId>no.priv.bang.jdbc</groupId>
          <artifactId>jdbc-bom</artifactId>
          <version>1.2.0</version>
          <type>pom</type>
          <scope>import</scope>
      </dependency>
  </dependencies>
#+end_src

And then adding a provided dependency for compilation and a feature repository dependency, to ensure the library is loaded at runtime:
#+begin_src xml
  <dependencies>
      <dependency>
          <groupId>no.priv.bang.jdbc</groupId>
          <artifactId>jdbc.datasourceproxy</artifactId>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>no.priv.bang.jdbc</groupId>
          <artifactId>jdbc.datasourceproxy</artifactId>
          <type>xml</type>
          <classifier>features</classifier>
      </dependency>
  </dependencies>
#+end_src
*** SqlDumper
This is a class that can export a [[https://docs.oracle.com/javase/17/docs/api/java/sql/ResultSet.html][JDBC ResultSet]] to an [[https://docs.oracle.com/en/java/javase/17/docs/api/java.base/java/io/OutputStream.html][OutputStream]] as an [[https://docs.liquibase.com/concepts/changelogs/sql-format.html][SQL formatted liquibase changeset]].

To use this in an OSGi maven project by first importing the BoM
#+begin_src xml
  <dependencies>
      <dependency>
          <groupId>no.priv.bang.jdbc</groupId>
          <artifactId>jdbc-bom</artifactId>
          <version>1.2.0</version>
          <type>pom</type>
          <scope>import</scope>
      </dependency>
  </dependencies>
#+end_src

And then adding a provided dependency for compilation and a feature repository dependency, to ensure the library is loaded at runtime:
#+begin_src xml
  <dependencies>
      <dependency>
          <groupId>no.priv.bang.jdbc</groupId>
          <artifactId>jdbc.sqldumper</artifactId>
          <scope>provided</scope>
      </dependency>
      <dependency>
          <groupId>no.priv.bang.jdbc</groupId>
          <artifactId>jdbc.sqldumper</artifactId>
          <type>xml</type>
          <classifier>features</classifier>
      </dependency>
  </dependencies>
#+end_src
** License

This code is licensed under the Apache license v. 2.  See the LICENSE file for details.
